home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MultiSession 1.04 Source / Core 27⁄June⁄1993 / CApplication.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-16  |  2.3 KB  |  78 lines  |  [TEXT/KAHL]

  1. /* CApplication.h */
  2.  
  3. #pragma once
  4.  
  5. #include <AppleEvents.h>
  6. #include "CWindow.h"
  7. #include "MiscInfo.h"
  8.  
  9. class CDocument;
  10. class CAboutWindow;
  11. class CMyApplication;
  12.  
  13. struct        CApplication    :    CWindow
  14.     {
  15.      private:
  16.         static CApplication*    GlobalApplication;
  17.      public:
  18.         CSack*                ListOfDocuments;
  19.         CAboutWindow*    AboutWindow;
  20.  
  21.         /* initialization routine */
  22.         /* */        CApplication();
  23.         /* */        ~CApplication();
  24.  
  25.         /* high level events get sent here to be handled */
  26.         void        ReceiveHighLevelEvent(EventRecord* Event);
  27.  
  28.         void        RegisterDocument(CDocument* TheDocument);
  29.         void        DeregisterDocument(CDocument* TheDocument);
  30.         void        InitiateQuit(void);
  31.  
  32.      protected:
  33.         /* high level event handlers send events here to be handled */
  34.         void        DispatchOpenApplication(void);
  35.         void        DispatchOpenDocument(FSSpec* TheFSSpec);
  36.         void        DispatchPrintDocument(FSSpec* TheFSSpec);
  37.         void        DispatchQuit(void);
  38.  
  39.         /* function to check to see that all required parameters have been gotten */
  40.         static    OSErr                    MyGotRequiredParams(AppleEvent* theAppleEvent);
  41.         /* handler for open application--presents an untitled document */
  42.         static    pascal    OSErr    MyHandleOApp(AppleEvent* theAppleEvent,
  43.                                                         AppleEvent* reply, long handlerRefcon);
  44.         /* handler for print documents */
  45.         static    pascal    OSErr    MyHandleODoc(AppleEvent* theAppleEvent,
  46.                                                         AppleEvent* reply, long handlerRefcon);
  47.         /* handler for print documents */
  48.         static    pascal    OSErr    MyHandlePDoc(AppleEvent* theAppleEvent,
  49.                                                         AppleEvent* reply, long handlerRefcon);
  50.         /* handle a quit event */
  51.         static    pascal    OSErr    MyHandleQuit(AppleEvent* theAppleEvent,
  52.                                                         AppleEvent* reply, long handlerRefcon);
  53.      public:
  54.         /* If the active window can't handle a menu command, it is sent here */
  55.         MyBoolean    DoMenuCommand(ushort MenuCommand);
  56.  
  57.         /* re-enable menu items that the application can handle */
  58.         void        EnableMenuItems(void);
  59.  
  60.         /* post the menus to the menu bar */
  61.         void        InitMenuBar(void);
  62.  
  63.         /* display the about window */
  64.         void        DoAboutWindow(MyBoolean AutoFlag);
  65.  
  66.         /* create a new document */
  67.         void        DoMenuNew(void);
  68.  
  69.         /* open a document using standard get file */
  70.         void        DoMenuOpen(void);
  71.         void        ConstructFileTypeTable(OSType Table[NUMFILETYPES], short* NumTypes,
  72.                             pascal Boolean (**FileFilter)(CInfoPBRec* pb));
  73.     };
  74.  
  75. #ifndef COMPILING_CAPPLICATION_C
  76.     extern CMyApplication* Application;
  77. #endif
  78.